function getPermisses() {
	var permissions = sessionStorage.getItem("permissions");
	if (null == permissions || permissions.length == 0) {
		$.ajax({
			type : 'get',
			async : false,
			url : _ctx + "/getPermissions",//请求数据的地址
			dataType : "json", //返回数据形式为json
			success : function(result) {
				//请求成功时执行该函数内容，result即为服务器返回的json对象           
				permissions = result.data;
				sessionStorage.setItem("permissions", permissions);
				return permissions;
			},
			error : function(errorMsg) {
				alert("获取权限失败。");
			}
		});
	}
	return permissions;
}

function checkPermission(permission) {
	var permissions = getPermisses();
	return permissions.includes(permission);
}

function hide() {
	var permissions = getPermisses();
	var tags = $("li[check-permission]");
	if (tags != null && tags.length >= 0) {
		tags.each(function(e) {
			if (!permissions.includes($(this).attr("check-permission"))) {
				$(this).removeClass("show").addClass("hidden");
			} else {
				$(this).removeClass("hidden").addClass("show");
			}
		})
	}
}

